/*
 * $Id: SttpCmd.hpp 50 2009-02-10 05:48:05Z hyunghwan.chung $
 *
   Copyright 2005-2009 Chung, Hyung-Hwan.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an  BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 */

#ifndef _XP_NET_STTPCMD_CLASS_
#define _XP_NET_STTPCMD_CLASS_

#include <xp/bas/String.hpp>
#include <xp/bas/Array.hpp>

namespace xp
{
	namespace net
	{
		
		class SttpCmd: public xp::bas::Array<xp::bas::String>
		{
		public:
			SttpCmd (const xp_char_t* n = XP_TEXT("")): 
				xp::bas::Array<xp::bas::String> (20, 20), name (n) {}
			SttpCmd (const xp::bas::String& n): 
				xp::bas::Array<xp::bas::String> (20, 20), name (n) {}

			xp_size_t argCount () const
			{
				return size ();
			}

			const xp_char_t* argAt (xp_size_t i) const
			{
				return get(i).buffer();
			}

			xp_size_t argLenAt (xp_size_t i) const
			{
				return get(i).size();
			}

			void addArg (const xp_char_t* n, xp_size_t size)
			{
				addDatum (xp::bas::String (n, 0, size));
			}

			void setName (const xp_char_t* n, xp_size_t size)
			{
				name.set (n, 0, size);
			}

			bool isNullCmd () const
			{
				return name.size() == 0;
			}

			xp::bas::String name;
		};

	}
}

#endif
